// -----------------------------------------------------------------------
// <copyright file="ServiceFile.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//    GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
// -----------------------------------------------------------------------
#region Usings

using System;
using System.ComponentModel;
using System.Xml.Schema;
using System.Xml.Serialization;

#endregion

namespace GateShift.Servers.GameServer.Configuration.Services
{
    /// <summary>
    /// Configuration setting for a Service File
    /// </summary>
    [XmlType(TypeName = "file")]
    [Serializable]
    public class ServiceFile
    {
        #region CTor/DTor
        /// <summary>
        /// Initializes a new instance of the ServiceFile class
        /// </summary>
        public ServiceFile()
        {
            IgnoredServices = new IgnoredServiceCollection();
        }

        /// <summary>
        /// Initializes a new instance of the ServiceFile class
        /// </summary>
        /// <param name="path">Path of the file for this setting</param>
        public ServiceFile(string path)
            : this()
        {
            Path = path;
            Enabled = true;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the path of the file for this setting
        /// </summary>
        [XmlAttribute(AttributeName = "path", Form = XmlSchemaForm.Unqualified, DataType = "string")]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        public string Path { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether or not the setting is enabled
        /// </summary>
        [XmlAttribute(AttributeName = "enabled", Form = XmlSchemaForm.Unqualified, DataType = "boolean")]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        public bool Enabled { get; set; }

        /// <summary>
        /// Gets or sets the list of ignored services for the setting
        /// </summary>
        [XmlElement(Type = typeof(IgnoredService), ElementName = "ignore", IsNullable = false, Form = XmlSchemaForm.Qualified)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        public IgnoredServiceCollection IgnoredServices { get; set; }
        #endregion
    }
}